package com.hzncc.flowable_diboot.vo;

import com.diboot.core.binding.annotation.BindDict;
import com.diboot.core.binding.annotation.BindField;
import com.diboot.core.vo.LabelValue;
import com.diboot.iam.entity.IamOrg;
import com.diboot.iam.entity.IamPosition;
import com.diboot.iam.entity.IamUser;
import com.hzncc.flowable_diboot.entity.Customer;
import com.hzncc.flowable_diboot.entity.SalesTeam;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
/**
* 销售团队 VO定义
* @author MyName
* @version 1.0
* @date 2024-06-25
* Copyright © MyCorp
*/
@Getter @Setter @Accessors(chain = true)
public class SalesTeamListVO extends SalesTeam  {
private static final long serialVersionUID = 1406122487370647569L;
    /**
    * 客户 关联信息
    */

    @BindField(
        entity = Customer.class,
        field = "name",
        condition = "this.customer_id = id"
     )
    private String customerIdLabel;

    /**
    * 负责人 关联信息
    */

    @BindField(
        entity = IamUser.class,
        field = "realname",
        condition = "this.manager_id = id"
     )
    private String managerIdLabel;

    /**
    * 成员 关联信息
    */

    @BindField(
        entity = IamUser.class,
        field = "realname",
        condition = "this.member = id"
     )
    private String memberLabel;

    /**
    * 部门 关联信息
    */

    @BindField(
        entity = IamOrg.class,
        field = "name",
       condition = "this.member = dbt_iam_user.id and dbt_iam_user.org_id = id"
     )
    private String dept;

    /**
    * 团队角色 关联字典选项
    */
    @BindDict(
    type = "TEAM_ROLE",
    field = "role"
    )
    private LabelValue roleLabel;

    /**
    * 权限 关联字典选项
    */
    @BindDict(
    type = "TEAM_PERMISSION",
    field = "permissions"
    )
    private LabelValue permissionsLabel;

    /**
    * 创建人 关联信息
    */

    @BindField(
        entity = IamUser.class,
        field = "realname",
        condition = "this.create_by = id"
     )
    private String createByLabel;

    /**
    * 更新人 关联信息
    */

    @BindField(
        entity = IamUser.class,
        field = "realname",
        condition = "this.update_by = id"
     )
    private String updateByLabel;

    /**
     * 岗位
     */
    @BindField(
        entity = IamPosition.class,
        field = "name",
        condition = "this.member = dbt_iam_user_position.user_id and dbt_iam_user_position.is_primary_position = 1 and dbt_iam_user_position.position_id = id"
    )
    private String position;
}